package com.loongxun.playwithyou.ui.activity;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.loongxun.playwithyou.R;
import com.loongxun.playwithyou.bean.Member;
import com.loongxun.playwithyou.bean.OrderMeg;
import com.loongxun.playwithyou.ui.adapter.ReportAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * 举报界面
 * Created by Administrator on 2017/10/16.
 */
public class ReportActivity extends Activity implements View.OnClickListener{

    private List<OrderMeg> report = new ArrayList<>();
    private String[] str_rep = {"虚假游戏段位","态度差","不文明用语","其他"};

    private TextView tv_top_title;
    private ListView iv_report;
    private ReportAdapter adapter;
    private EditText et_cc;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_report);
        for (int i= 0;i<4;i++){
            OrderMeg meg = new OrderMeg();
            meg.setOrderState(0);
            meg.setStart(i + 1);
            meg.setOrder_no(str_rep[i]);
           report.add(meg);
        }
        initView();

        adapter = new ReportAdapter(this,report);
        iv_report.setAdapter(adapter);

    }

    private void initView() {
        tv_top_title = (TextView) findViewById(R.id.tv_top_title);
        tv_top_title.setText("举报");
        findViewById(R.id.iv_back).setOnClickListener(this);

        et_cc = (EditText) findViewById(R.id.et_cc);

        iv_report = (ListView) findViewById(R.id.iv_report);
        findViewById(R.id.tv_report_save).setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.iv_back:
                finish();
                break;
            case R.id.tv_report_save:
                if (et_cc.getText().toString().trim().length()>0) {
                    Toast.makeText(this, "举报成功，谢谢您的举报，我们的工作人员会尽快核实您的举报信息", Toast.LENGTH_SHORT).show();
                    finish();
                }else {
                    Toast.makeText(this, "举报内容不能为空", Toast.LENGTH_SHORT).show();
                }
                break;
            default:
                break;
        }
    }
}
